package Base;


import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

import Main.GamePanel;


public class Constantes {

	public static BufferedImage imgFumaca = null;
	public static BufferedImage imgFumaca1 = null;

	public static boolean colidecircular(double X1, double Y1, double R1,
			double X2, double Y2, double R2) {

		double dx = X1 - X2;
		double dy = Y1 - Y2;
		double sr = R1 + R2;
		double d2 = dx * dx + dy * dy;

		if (d2 < (sr * sr)) {
			return true;
		}

		return false;
	}
	
//	public static boolean ColisaoRetangular(double X1,double Y1,double finalX1,double finalY1,double X2,double Y2,double finalX2,double finalY2){
//		if((X1 < finalX2) && (finalX1 > X2) && (Y1 < finalY2) && (finalY1 > Y2)){
//			return true;
//		}else{
//			return false;
//		}		
//	}
	
	public static boolean ColisaoRetangular(double X1,double Y1,double X2,double Y2,double X3,double Y3,double X4,double Y4){
		if((X1<X4)&&(X2>X3)&&(Y1<Y4)&&(Y2>Y3)){
			return true;
		}else{
			return false;
		}		
	}

	public static BufferedImage LoadImage(String filename) {
		BufferedImage image = null;

		BufferedImage imgtmp;
		try {
			imgtmp = ImageIO.read(GamePanel.instance.getClass().getResource(
					filename));
			image = new BufferedImage(imgtmp.getWidth(), imgtmp.getHeight(),
					BufferedImage.TYPE_INT_ARGB);
			image.getGraphics().drawImage(imgtmp, 0, 0, null);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return image;
	}
}
